/**
 * @author fu
 * @date 2022-01-24 22:09
 * 概要：
 * ---------------------------------------------------------------
 * |                                                              |
 * |                  |
 * |                                                             |
 * |=============================================================
 */
public class Happens_before {

    volatile static int volatileX;
    static int y;
    static int a;
    static int b;
    static int c;

    public static void main(String[] args) {

        new Thread(()->{
            a=100;
            b=200;
            c=300;
            volatileX = 20;
            y = 10;

        },"t1").start();

        new Thread(()->{
            System.out.println(a);
            System.out.println(b);
            System.out.println(c);

// x=20 对 t2 可见, 同时 y=10 也对 t2 可见
            System.out.println(volatileX);
            System.out.println(y);
        },"t2").start();

    }



}
